<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			body{
				padding: 0;
				margin: 0;
				background-color: #040d15;
				min-height: 100vh;
				display: flex;
				justify-content: center;
				align-items: center;
			}
			#login{
				position: relative;
				display: inline-block;
				padding: 20px 80px;
				border-radius: 25px;
				text-decoration: none;
				color: #fff;
				text-transform: uppercase;
				letter-spacing: 3px;				
				overflow: hidden;
				background: linear-gradient(45deg,#55ff00,#55ff7f,#55ffff);}
			span{
				position: absolute;
				background: #fff;
				border-radius: 50%;
				transform: translate(-50%,-50%);
				pointer-events: none;
				animation: anim 1s linear infinite;
			}
			@keyframes anim{
				from{
					width: 0;
					height: 0;
					opacity: 0.5;
				}
				to{
					width: 400px;
					height: 400px;
					opacity: 0;
				}
			}
		</style>
	</head>
	<body>
		<a id="login" href="#">Login</a>
		<script type="text/javascript">
			var button = document.getElementById('login')
				button.addEventListener('click',function(e){
					console.log(e.target.offsetLeft,e.target.offsetTop);
					// client 返回事件被触发时,鼠标的相应坐标
					// target 返回触发此事件的元素
					// offsetLeft 返回元素距离document的距离
					let x = e.clientX - e.target.offsetLeft
					let y = e.clientY - e.target.offsetTop
					
					console.log(x,y);
					
					let ele = document.createElement('span')
					ele.style.left = x +'px'
					ele.style.top = y +'px'
					
					this.appendChild(ele)
					
					setTimeout(()=>{
						ele.remove()
					},1000)
				})
		</script>
	</body>
</html>
